package side;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
       
public class SideDish {
	
	
	public static void wait (int n){
        long t0,t1;
        t0=System.currentTimeMillis();
        do{
            t1=System.currentTimeMillis();
        }
        while (t1-t0<n);
}

	public static void splitString(String example, String st)
	{
		ArrayList<String> tokens = new ArrayList<String>(Arrays.asList(example.split(st)));
		int j = 0;
		
		for(int i=0;i<tokens.size();i++)
		{
			if(tokens.get(i) == st)
			{
				
			}
		}
		
	} 
        
        
        public static String md5(String input) throws IOException {
        String md5 = null;
         String everything = null;
    try (BufferedReader br = new BufferedReader(new FileReader(input))) {
        StringBuilder sb = new StringBuilder();
        String line = br.readLine();

        while (line != null) {
            sb.append(line);
            sb.append("\n");
            line = br.readLine();
        }
       everything = sb.toString();
    }
       
        try {

        MessageDigest digest = MessageDigest.getInstance("MD5");
        digest.update(everything.getBytes(), 0, everything.length());
        md5 = new BigInteger(1, digest.digest()).toString(16);
 
        } catch (NoSuchAlgorithmException e) {
 
            e.printStackTrace();
        }
       
        return md5;
    }
        
}
